﻿@using Commonality.ServerEnum
 @using ModelToDto;
@using Commonality;
@model List<UsersDTO>
<table class="table table-hover">
    <tr>
        <th>Id</th>
        <th>名称</th>
        <th>用户类型</th>
        <th>手机号</th>
        <th>性别</th>
        <th>状态</th>
        <th>创建时间</th>
        <th>地址</th>
        <th>操作</th>
    </tr>
    @foreach (UsersDTO item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.UserId)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @switch ((UserTypeEnum)item.UserType)
                {
                    case UserTypeEnum.Admin:
                        <button type="button" class="btn btn-success">@Html.DisplayFor(modelItem => item.UserTypeRemark)</button>
                        break;
                    case UserTypeEnum.Anchor:
                        <button type="button" class="btn btn-warning">@Html.DisplayFor(modelItem => item.UserTypeRemark)</button>
                        break;
                    case UserTypeEnum.Ordinary:
                        <button type="button" class="btn btn-secondary">@Html.DisplayFor(modelItem => item.UserTypeRemark)</button>
                        break;
                    default:
                        break;
                }
                @*  @Html.DisplayFor(modelItem => item.UserTypeRemark)*@

            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Mobile)
            </td>
            <td>
                @switch ((GenderEnum)item.Sex)
                {
                    case GenderEnum.Male:
                        <button type="button" class="btn btn-secondary">@Html.DisplayFor(modelItem => item.SexRemark)</button>
                        break;
                    case GenderEnum.Female:
                        <button type="button" class="btn btn-warning">@Html.DisplayFor(modelItem => item.SexRemark)</button>
                        break;
                    case GenderEnum.Simon:
                        <button type="button" class="btn btn-danger">@Html.DisplayFor(modelItem => item.SexRemark)</button>
                        break;
                    default:
                        break;
                }
                @*  @Html.DisplayFor(modelItem => item.SexRemark)*@
            </td>
            <td>
                @switch ((UserStatuEnum)item.Status)
                {
                    case UserStatuEnum.Frozen:
                        <button type="button" class="btn btn-info">@Html.DisplayFor(modelItem => item.StatusRemark)</button>
                        break;
                    case UserStatuEnum.Normal:
                        <button type="button" class="btn btn-success">@Html.DisplayFor(modelItem => item.StatusRemark)</button>
                        break;
                    case UserStatuEnum.Delete:
                        <button type="button" class="btn btn-danger">@Html.DisplayFor(modelItem => item.StatusRemark)</button>
                        break;
                    default:
                        break;
                }

                @* @Html.DisplayFor(modelItem => item.UserStatusRemark)*@
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.LastLoginTime)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Address)
            </td>
            <td>
              @*   <input type="button" class="btn btn-primary" value="冻结" onclick='location.href=("/User/AssignRoles?id=@item.UserId")'> ||
                <input type="button" class="btn btn-primary" value="解冻" onclick='location.href=("/User/AssignRoles?id=@item.UserId")'> ||
                <input type="button" class="btn btn-primary" value="详情" onclick='location.href=("/User/AssignRoles?id=@item.UserId")'> || *@
                <input type="button" class="btn btn-primary" value="分配角色" onclick='location.href=("/User/AssignRoles?id=@item.UserId")'> ||
                <button type="button" onclick="confirm(ajaxDelete,@item.UserId)" class="btn btn-danger">删除</button>
            </td>
        </tr>
    }
</table>
